# -*- coding: utf-8 -*-
"""
Created on Thu Feb 03 22:20:05 2011

@author: Mauricio zaz
"""

#!/usr/bin/python
# -*- coding: utf-8 -*-
 
from PyQt4 import QtGui, QtCore
import sys
 
import ImageViewerUI
from logico.iABJ import *
 
class ImageViewer(QtGui.QMainWindow, ImageViewerUI.Ui_mainWindow):

 
    def __init__(self, parent=None):
        super(ImageViewer, self).__init__(parent)
        self.setupUi(self)
        self.connectActions()
 
    def connectActions(self):
        self.actionQuit.triggered.connect(QtGui.qApp.quit)
        self.actionOpen.triggered.connect(self.openImage)

    def openImage(self):
        fileName = QtGui.QFileDialog.getOpenFileName(
                        self,
                        "Open Image File",
                        QtCore.QDir.homePath(),
                        "Image Files (*.jpg *.jpeg *.gif *.png)"
                    )
        if fileName:
            print fileName
            self.imageLabel.setPixmap(QtGui.QPixmap(fileName))

    def main(self):
        self.show()
 
if __name__=='__main__':
	app = QtGui.QApplication(sys.argv)
	logico = LogicoABJ("idiomas/ES.xml", "Nombre de Prueba")
	logico.runCommand("resuelve casa")
	#logico._problema.
	imageViewer = ImageViewer()
	imageViewer.main()
	app.exec_()